//Index controller
MelonMissionApp.controller("indexController", function indexController($scope, $http, melonService){
  $scope.slides = [
	{
        "ImageID": 1,
        "Title": "Image 1",
        "text": "Lorem ipsum ad his scripta blandit partiendo",
        "image": currentPath +'assets/images/slider/0.jpg'
    },
    {
        "ImageID": 2,
        "Title": "Image 2",
        "text": "Lorem ipsum ad his scripta blandit partiendo",
        "image": currentPath +'assets/images/slider/1.jpg'
    },
    {
        "ImageID": 3,
        "Title": "Image 3",
        "text": "Lorem ipsum ad his scripta blandit partiendo",
        "image": currentPath +'assets/images/slider/2.jpg'
    }
  ];
  $scope.myInterval = 5000;

  melonService.initFB(document, 'script', 'facebook-jssdk');

});

//About controller
MelonMissionApp.controller('aboutController', function aboutController($scope, melonService){

  melonService.initFB(document, 'script', 'facebook-jssdk');

});

//History controller
MelonMissionApp.controller('historyController', function historyController($scope, melonService){

  melonService.initFB(document, 'script', 'facebook-jssdk');

});

//History controller
MelonMissionApp.controller('meetTeamController', function meetTeamController($scope, melonService){

  melonService.initFB(document, 'script', 'facebook-jssdk');

});

//Download Buttom Directive
MelonMissionApp.directive("dropdownBehavior", function(){
  return {
   restrict: "A",
   link: function(scope, element, attrs){
        element.bind('click', function (event) {
          event.preventDefault();
        });
     }
  };
});

//Melon Mission Service
MelonMissionApp.service('melonService', function($http){
  // Return public API.
  return({
      initFB: initFB
  });

  //Inits the Facebook API
  function initFB(d, s, id) {
    if(typeof FB !== undefined){
      FB = undefined;
    }
    var js, fjs = d.getElementsByTagName(s)[0];
    //if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=448050108575505";
    fjs.parentNode.insertBefore(js, fjs);
  }
});